#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   App_CommunicationControl_0x28_test.py
@Time    :   2024/09/10 13:31:28
@Author  :   yangliang 
@Version :   1.0
@Contact :   yangliang@chengtech.com
@License :   (C)Copyright 2022-2025
@Desc    :   None
'''

# here put the import lib
from pytest_assume.plugin import assume
 
import pytest
import logging
import time
import requests
from sympy import I
# from sympy import assuming
from commDriver.TS_CAN import *
from commDriver.modbus_plc import *
import allure
import sys
import Set_up
from collections.abc import Iterable

from sqlalchemy import false
sys.dont_write_bytecode = True


communicationControl_NRC_Phy = [    ([0x28],[0x7F,0x28,0x13]),                    
                                    ([0x28,0x00],[0x7F,0x28,0x13]),
                                    ([0x28,0x03],[0x7F,0x28,0x13]),
                                    ([0x28,0x00,0x01,0x15],[0x7F,0x28,0x13]),
                                    ([0x28,0x00,0x03,0xFF],[0x7F,0x28,0x13]),  
                                    ([0x28,0x03,0x01,0x25],[0x7F,0x28,0x13]),
                                    ([0x28,0x03,0x03,0x06],[0x7F,0x28,0x13]),     
                                    ([0x28,0x04,0x01],[0x7F,0x28,0x12]),         
                                    ([0x28,0x04,0x03],[0x7F,0x28,0x12]),
                                    ([0x28,0x05,0x01],[0x7F,0x28,0x12]),         
                                    ([0x28,0x05,0x03],[0x7F,0x28,0x12]),
                                    ([0x28,0x06,0x01],[0x7F,0x28,0x12]),        
                                    ([0x28,0x06,0x03],[0x7F,0x28,0x12]),
                                    ([0x28,0x3F,0x01],[0x7F,0x28,0x12]),         
                                    ([0x28,0x3F,0x03],[0x7F,0x28,0x12]),
                                    ([0x28,0x40,0x01],[0x7F,0x28,0x12]),         
                                    ([0x28,0x40,0x03],[0x7F,0x28,0x12]),
                                    ([0x28,0x5F,0x01],[0x7F,0x28,0x12]),         
                                    ([0x28,0x5F,0x03],[0x7F,0x28,0x12]),
                                    ([0x28,0x60,0x01],[0x7F,0x28,0x12]),         
                                    ([0x28,0x60,0x03],[0x7F,0x28,0x12]),
                                    ([0x28,0x7E,0x01],[0x7F,0x28,0x12]),         
                                    ([0x28,0x7E,0x03],[0x7F,0x28,0x12]),
                                    ([0x28,0x7F,0x01],[0x7F,0x28,0x12]),         
                                    ([0x28,0x7F,0x03],[0x7F,0x28,0x12]),

                                    ([0x28,0x00,0x00],[0x7F,0x28,0x31]),
                                    ([0x28,0x01,0x00],[0x7F,0x28,0x31]),
                                    ([0x28,0x02,0x00],[0x7F,0x28,0x31]),     
                                    ([0x28,0x03,0x00],[0x7F,0x28,0x31]),
                                    ([0x28,0x00,0x04],[0x7F,0x28,0x31]),
                                    ([0x28,0x01,0x04],[0x7F,0x28,0x31]),     
                                    ([0x28,0x02,0x04],[0x7F,0x28,0x31]),             
                                    ([0x28,0x03,0x04],[0x7F,0x28,0x31]),
                                    ([0x28,0x00,0x7F],[0x7F,0x28,0x31]),           
                                    ([0x28,0x03,0x7F],[0x7F,0x28,0x31]), 
                                ]
                                 
NRC7F_Phy = [                   ([0x28,0x03,0x01],[0x7F,0x28,0x7F]),
                                ([0x28,0x03,0x02],[0x7F,0x28,0x7F]),
                                ([0x28,0x03,0x03],[0x7F,0x28,0x7F]),
                                ([0x28,0x02,0x01],[0x7F,0x28,0x7F]),
                                ([0x28,0x02,0x02],[0x7F,0x28,0x7F]),
                                ([0x28,0x02,0x03],[0x7F,0x28,0x7F]),
                                ([0x28,0x01,0x01],[0x7F,0x28,0x7F]),
                                ([0x28,0x01,0x02],[0x7F,0x28,0x7F]),
                                ([0x28,0x01,0x03],[0x7F,0x28,0x7F]),
                                ([0x28,0x00,0x01],[0x7F,0x28,0x7F]), 
                                ([0x28,0x00,0x02],[0x7F,0x28,0x7F]),  
                                ([0x28,0x00,0x03],[0x7F,0x28,0x7F])
            ]

SuppressPosMsg_NRC11_Phy = [([0x28,0x83,0x01],[0x7F,0x28,0x11]),
                            ([0x28,0x83,0x02],[0x7F,0x28,0x11]),
                            ([0x28,0x83,0x03],[0x7F,0x28,0x11]),
                            ([0x28,0x82,0x01],[0x7F,0x28,0x11]),
                            ([0x28,0x82,0x02],[0x7F,0x28,0x11]),
                            ([0x28,0x82,0x03],[0x7F,0x28,0x11]),
                            ([0x28,0x81,0x01],[0x7F,0x28,0x11]),
                            ([0x28,0x81,0x02],[0x7F,0x28,0x11]),
                            ([0x28,0x81,0x03],[0x7F,0x28,0x11]),
                            ([0x28,0x80,0x01],[0x7F,0x28,0x11]), 
                            ([0x28,0x80,0x02],[0x7F,0x28,0x11]),  
                            ([0x28,0x80,0x03],[0x7F,0x28,0x11])]


communicationControl_NRC13_Fun = [  ([0x28],[0x7F,0x28,0x13]),                    
                                    ([0x28,0x00],[0x7F,0x28,0x13]),
                                    ([0x28,0x01],[0x7F,0x28,0x13]),
                                    ([0x28,0x02],[0x7F,0x28,0x13]),
                                    ([0x28,0x03],[0x7F,0x28,0x13]),
                                    ([0x28,0x00,0x01,0x15],[0x7F,0x28,0x13]),
                                    ([0x28,0x00,0x03,0xFF],[0x7F,0x28,0x13]),
                                    ([0x28,0x01,0x01,0x15],[0x7F,0x28,0x13]),
                                    ([0x28,0x02,0x01,0x15],[0x7F,0x28,0x13]),  
                                    ([0x28,0x03,0x01,0x25],[0x7F,0x28,0x13]),
                                    ([0x28,0x03,0x03,0x06],[0x7F,0x28,0x13])
                                ]

communicationControl_No_Resp_Fun = [([0x28,0x07,0x01],[]),      
                                    ([0x28,0x07,0x03],[]),
                                    ([0x28,0x04,0x01],[]),         
                                    ([0x28,0x04,0x03],[]),
                                    ([0x28,0x05,0x01],[]),         
                                    ([0x28,0x05,0x03],[]),
                                    ([0x28,0x06,0x01],[]),        
                                    ([0x28,0x06,0x03],[]),
                                    ([0x28,0x3F,0x01],[]),         
                                    ([0x28,0x3F,0x03],[]),
                                    ([0x28,0x40,0x01],[]),         
                                    ([0x28,0x40,0x03],[]),
                                    ([0x28,0x5F,0x01],[]),         
                                    ([0x28,0x5F,0x03],[]),
                                    ([0x28,0x60,0x01],[]),         
                                    ([0x28,0x60,0x03],[]),
                                    ([0x28,0x7E,0x01],[]),         
                                    ([0x28,0x7E,0x03],[]),
                                    ([0x28,0x7F,0x01],[]),         
                                    ([0x28,0x7F,0x03],[]),
                                    ([0x28,0x00,0x00],[]),
                                    ([0x28,0x01,0x00],[]),
                                    ([0x28,0x02,0x00],[]),     
                                    ([0x28,0x03,0x00],[]),
                                    ([0x28,0x00,0x04],[]),
                                    ([0x28,0x01,0x04],[]),     
                                    ([0x28,0x02,0x04],[]),             
                                    ([0x28,0x03,0x04],[]),
                                    ([0x28,0x00,0x7F],[]),           
                                    ([0x28,0x03,0x7F],[])
                                ]

communicationControl_SuppressPosMsg_NRC_Phy = [                   
                                               ([0x28,0x80],[0x7F,0x28,0x13]),
                                               ([0x28,0x81],[0x7F,0x28,0x13]),
                                               ([0x28,0x82],[0x7F,0x28,0x13]),
                                               ([0x28,0x83],[0x7F,0x28,0x13]),
                                               ([0x28,0x80,0x01,0x15],[0x7F,0x28,0x13]),
                                               ([0x28,0x80,0x02,0x15],[0x7F,0x28,0x13]),
                                               ([0x28,0x80,0x03,0xFF],[0x7F,0x28,0x13]),
                                               ([0x28,0x81,0x01,0x15],[0x7F,0x28,0x13]),
                                               ([0x28,0x81,0x02,0x15],[0x7F,0x28,0x13]),
                                               ([0x28,0x81,0x03,0xFF],[0x7F,0x28,0x13]),
                                               ([0x28,0x82,0x01,0x15],[0x7F,0x28,0x13]),
                                               ([0x28,0x82,0x02,0x15],[0x7F,0x28,0x13]),
                                               ([0x28,0x82,0x03,0xFF],[0x7F,0x28,0x13]),  
                                               ([0x28,0x83,0x01,0x25],[0x7F,0x28,0x13]),
                                               ([0x28,0x83,0x02,0x15],[0x7F,0x28,0x13]),
                                               ([0x28,0x83,0x03,0x06],[0x7F,0x28,0x13]),   
                                            #    ([0x28,0x82,0x01],[0x7F,0x28,0x12]),         
                                            #    ([0x28,0x82,0x03],[0x7F,0x28,0x12]),
                                            #    ([0x28,0x81,0x01],[0x7F,0x28,0x12]),      
                                            #    ([0x28,0x81,0x03],[0x7F,0x28,0x12]),
                                               ([0x28,0x84,0x01],[0x7F,0x28,0x12]),         
                                               ([0x28,0x84,0x03],[0x7F,0x28,0x12]),
                                               ([0x28,0x85,0x01],[0x7F,0x28,0x12]),         
                                               ([0x28,0x85,0x03],[0x7F,0x28,0x12]),
                                               ([0x28,0x86,0x01],[0x7F,0x28,0x12]),        
                                               ([0x28,0x86,0x03],[0x7F,0x28,0x12]),
                                               ([0x28,0xBF,0x01],[0x7F,0x28,0x12]),         
                                               ([0x28,0xBF,0x03],[0x7F,0x28,0x12]),
                                               ([0x28,0xC0,0x01],[0x7F,0x28,0x12]),         
                                               ([0x28,0xC0,0x03],[0x7F,0x28,0x12]),
                                               ([0x28,0xDF,0x01],[0x7F,0x28,0x12]),         
                                               ([0x28,0xDF,0x03],[0x7F,0x28,0x12]),
                                               ([0x28,0xE0,0x01],[0x7F,0x28,0x12]),         
                                               ([0x28,0xE0,0x03],[0x7F,0x28,0x12]),
                                               ([0x28,0xFE,0x01],[0x7F,0x28,0x12]),         
                                               ([0x28,0xFE,0x03],[0x7F,0x28,0x12]),
                                               ([0x28,0xFF,0x01],[0x7F,0x28,0x12]),         
                                               ([0x28,0xFF,0x03],[0x7F,0x28,0x12]),
                                            #    ([0x28,0x82,0x02],[0x7F,0x28,0x12]),
                                               ([0x28,0x80,0x00],[0x7F,0x28,0x31]),
                                               ([0x28,0x81,0x00],[0x7F,0x28,0x31]),
                                               ([0x28,0x82,0x00],[0x7F,0x28,0x31]),     
                                               ([0x28,0x83,0x00],[0x7F,0x28,0x31]),
                                               ([0x28,0x80,0x04],[0x7F,0x28,0x31]),
                                               ([0x28,0x81,0x04],[0x7F,0x28,0x31]),     
                                               ([0x28,0x82,0x04],[0x7F,0x28,0x31]),             
                                               ([0x28,0x83,0x04],[0x7F,0x28,0x31]),
                                               ([0x28,0x80,0x7F],[0x7F,0x28,0x31]),           
                                               ([0x28,0x83,0x7F],[0x7F,0x28,0x31])]

communicationControl_SuppressPosMsg_NRC13_Fun = [                   
                                                  ([0x28,0x80],[0x7F,0x28,0x13]),
                                                  ([0x28,0x81],[0x7F,0x28,0x13]),
                                                  ([0x28,0x82],[0x7F,0x28,0x13]),
                                                  ([0x28,0x83],[0x7F,0x28,0x13]),
                                                  ([0x28,0x80,0x01,0x15],[0x7F,0x28,0x13]),
                                                  ([0x28,0x80,0x02,0x15],[0x7F,0x28,0x13]),
                                                  ([0x28,0x80,0x03,0xFF],[0x7F,0x28,0x13]),
                                                  ([0x28,0x81,0x01,0x15],[0x7F,0x28,0x13]),
                                                  ([0x28,0x81,0x02,0x15],[0x7F,0x28,0x13]),
                                                  ([0x28,0x81,0x03,0xFF],[0x7F,0x28,0x13]),
                                                  ([0x28,0x82,0x01,0x15],[0x7F,0x28,0x13]),
                                                  ([0x28,0x82,0x02,0x15],[0x7F,0x28,0x13]),
                                                  ([0x28,0x82,0x03,0xFF],[0x7F,0x28,0x13]),  
                                                  ([0x28,0x83,0x01,0x25],[0x7F,0x28,0x13]),
                                                  ([0x28,0x83,0x02,0x15],[0x7F,0x28,0x13]),
                                                  ([0x28,0x83,0x03,0x06],[0x7F,0x28,0x13])]

communicationControl_SuppressPosMsg_No_Resp_Fun = [([0x28,0x84,0x01],[]),         
                                                    ([0x28,0x84,0x03],[]),
                                                    ([0x28,0x85,0x01],[]),         
                                                    ([0x28,0x85,0x03],[]),
                                                    ([0x28,0x86,0x01],[]),        
                                                    ([0x28,0x86,0x03],[]),
                                                    ([0x28,0xBF,0x01],[]),         
                                                    ([0x28,0xBF,0x03],[]),
                                                    ([0x28,0xC0,0x01],[]),         
                                                    ([0x28,0xC0,0x03],[]),
                                                    ([0x28,0xDF,0x01],[]),         
                                                    ([0x28,0xDF,0x03],[]),
                                                    ([0x28,0xE0,0x01],[]),         
                                                    ([0x28,0xE0,0x03],[]),
                                                    ([0x28,0xFE,0x01],[]),         
                                                    ([0x28,0xFE,0x03],[]),
                                                    ([0x28,0xFF,0x01],[]),         
                                                    ([0x28,0xFF,0x03],[]),
                                                    ([0x28,0x82,0x02],[]),
                                                    ([0x28,0x80,0x02],[]),     
                                                    ([0x28,0x83,0x02],[]),
                                                    ([0x28,0x80,0x04],[]),             
                                                    ([0x28,0x83,0x04],[]),
                                                    ([0x28,0x80,0x7F],[]),           
                                                    ([0x28,0x83,0x7F],[])]

'''
SpeedVD_signal 0x0: not valid
SpeedVD_signal 0x1: valid
'''
SpeedVD_signal = Set_up.NetName,Set_up.nodeName,'PBM_0x185','WCBS_ESP5_F_VehicleSpeed'
SpeedACT_signal = Set_up.NetName,Set_up.nodeName,'PBM_0x185','VehSpd'


class Message_ID(object):
   if Set_up.act_radar_type == 'LFCR':
      Radar_NM_message_ID =  0x448
      Radar_App_message_ID = 0x385
   elif Set_up.act_radar_type == 'RFCR':
      Radar_NM_message_ID =  0x449
      Radar_App_message_ID = 0x384
   elif Set_up.act_radar_type == 'RLCR':
      Radar_NM_message_ID =  0x44A
    #   Radar_App_message_ID = 0x385
   else:
      Radar_NM_message_ID =  0x44C
      Radar_App_message_ID = 0x224


class Test_CommunicationControl_Phy(object):
    '''
    Sub-F:0x00 使能接收和发送
    Sub-F:0x01 使能接收且禁止发送
    Sub-F:0x02 禁止接收且使能发送
    Sub-F:0x03 禁止接收和发送
    prameter:0x01 常规应用报文
    prameter:0x02 网络管理报文
    prameter:0x03 网络管理报文和常规应用报文
    '''

    def setSignalValue(self, Driver,signal_list,value):
        Driver['CAN'].write_db_signal(signal_list[0],signal_list[1], signal_list[2], signal_list[3], value)
        time.sleep(0.2)
        readValue = Driver['CAN'].read_db_signal(signal_list[0],signal_list[1], signal_list[2], signal_list[3])


    @pytest.mark.smoke
    @allure.severity('normal')
    @allure.story('Communication Control Test')
    @allure.description('Test control message by SID 0x28 with physical addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    def test_CommunicationControl_disableRxAndTx_Extended_Phy(self,action,Driver):
        time.sleep(5)
        fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
        fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
        with allure.step('step1:Request:0x10,0x03, # Response:0x50,0x03'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]
        with allure.step('step2:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step3:Request:0x28,0x03,0x01, # Response:0x68,0x03 常规应用报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x03,0x01],3)
            if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x03]
            time.sleep(1)
        with allure.step('step4:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(3)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

        with allure.step('step5:Request:0x28,0x00,0x01, # Response:0x68,0x00,常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x00,0x01],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]
            
            time.sleep(1)
        with allure.step('step6:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step7:Request:0x28,0x03,0x03, # Response:0x68,0x03,网络管理报文和常规应用报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x03,0x03],3)
            if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x03]
            time.sleep(1)
        with allure.step('step8:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step9:Request:0x28,0x00,0x03, # Response:0x68,0x00,网络管理报文和常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x00,0x03],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]

            time.sleep(1)
        with allure.step('step10:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

        with allure.step('step11:Request:0x28,0x03,0x02, # Response:0x68,0x03,网络管理报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x03,0x02],3)
            if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x03]
            time.sleep(1)
        with allure.step('step12:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step13:Request:0x28,0x00,0x02, # Response:0x68,0x00,网络管理报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x00,0x02],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]

            time.sleep(1)
        with allure.step('step14:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

    @pytest.mark.smoke
    @allure.severity('normal')
    @allure.description('Test Test control message by SID 0x28 with physical addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
#    Test postive response of 0x28 in extended session with physical addressing
    def test_CommunicationControl_enableRxAndDisableTx_Extended_Phy(self,action,Driver):
        with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]
        with allure.step('step2:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step3:Request:0x28,0x01,0x01, # Response:0x68,0x01, 常规应用报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x01,0x01],3)
            if  uds_rep[0:2] != [0x68,0x01]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x01], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x01]
            time.sleep(1)
        with allure.step('step4:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(4)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD') # Message_ID.Radar_App_message_ID
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

        with allure.step('step5:Request:0x28,0x00,0x01, # Response:0x68,0x00, 常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x00,0x01],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]
            
            time.sleep(1)
        with allure.step('step6:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD') # Message_ID.Radar_App_message_ID
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step7:Request:0x28,0x03,0x03, # Response:0x68,0x03, 网络管理报文和常规应用报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x03,0x03],3)
            if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x03]
            time.sleep(1)
        with allure.step('step8:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD') # Message_ID.Radar_App_message_ID
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step9:Request:0x28,0x00,0x03, # Response:0x68,0x00, 网络管理报文和常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x00,0x03],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]

            time.sleep(1)
        with allure.step('step10:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD') # Message_ID.Radar_App_message_ID
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

        with allure.step('step11:Request:0x28,0x03,0x02, # Response:0x68,0x03, 网络管理报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x03,0x02],3)
            if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x03]
            time.sleep(1)
        with allure.step('step12:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step13:Request:0x28,0x00,0x02, # Response:0x68,0x00, 网络管理报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x00,0x02],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]

            time.sleep(1)
        with allure.step('step14:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')  # (Message_ID.Radar_NM_message_ID)
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

    @pytest.mark.smoke
    @allure.severity('normal')
    @allure.description('Test Test control message by SID 0x28 with physical addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
#    Test postive response of 0x28 in extended session with physical addressing
    def test_CommunicationControl_disableRxAndEnableTx_Extended_Phy(self,action,Driver):
        with allure.step('step1:Request:0x10,0x03, # Response:0x50,0x03'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]
        with allure.step('step2:Request:设置速度信号为1'):
            self.setSignalValue(Driver,SpeedVD_signal,1)
            self.setSignalValue(Driver,SpeedACT_signal,1)
        with allure.step('step3:Request:0x28,0x02,0x01,# Response:0x68,0x02, 禁接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x02,0x01],3)
            if  uds_rep[0:2] != [0x68,0x02]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x02], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x02]
            time.sleep(1)
        with allure.step('step4:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step5:Request:设置速度为2'):
            self.setSignalValue(Driver,SpeedACT_signal,2)
            time.sleep(4)
        with allure.step('step6:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('ste7:Request:0x22,0x12,0x61, # Response:0x62,0x12,0x61,0x00,0x12'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x0A]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x12], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x0A]

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step8:Request:0x28,0x00,0x01, # Response:0x68,0x00, 可接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x00,0x01],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]
        with allure.step('step9:Request:0x3E,0x00, # Response:0x7E,0x00'):
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step10:Request:设置速度为2'):
            self.setSignalValue(Driver,SpeedACT_signal,2)
            time.sleep(1)
        with allure.step('step11:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('ste12:Request:0x22,0x12,0x61, # Response:0x62,0x12,0x61,0x00,0x24'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x14]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x14], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x14]
            
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step13:Request:0x28,0x02,0x03, # Response:0x68,0x02, 禁接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x02,0x03],3)
            if  uds_rep[0:2] != [0x68,0x02]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x02], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x02]
            time.sleep(1)
            self.setSignalValue(Driver,SpeedACT_signal,1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step14:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x24'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x14]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x14], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x14]

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps
        with allure.step('step15:Request:0x28,0x00,0x03, # Response:0x68,0x00, 可接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x00,0x03],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]

            time.sleep(1)
            self.setSignalValue(Driver,SpeedACT_signal,1)
        with allure.step('step16:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x0A]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x0A], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x0A]
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step17:Request:0x28,0x02,0x02,# Response:0x68,0x02, 禁接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x02,0x02],3)#禁止收到网络管理报文，所以收到App还是可以收到的
            if  uds_rep[0:2] != [0x68,0x02]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x02], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x02]
            time.sleep(1)
            self.setSignalValue(Driver,SpeedACT_signal,2)
        with allure.step('step18:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step19:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x14'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x14]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x14], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x14]

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps
        with allure.step('step20:Request:0x28,0x00,0x02, # Response:0x68,0x00, 可接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x00,0x02],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]

            time.sleep(1)
            self.setSignalValue(Driver,SpeedACT_signal,2)
        with allure.step('step21:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step22:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x14'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x14]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x14], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x14]

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

            self.setSignalValue(Driver,SpeedACT_signal,0)
            self.setSignalValue(Driver,SpeedVD_signal,0)


    @pytest.mark.smoke
    @allure.severity('normal')
    @allure.description('Test Function failure after switch session to default of 0x28')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    def test_CommunicationControl_Function_failure_after_switch_session_Extended_Phy(self,action,Driver):
        #test 切换会话至默认会话或停发0x3E服务等待会话超时后，报文恢复正常发送
        with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]
        with allure.step('step2:Request:0x3E,0x00,# Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step3:Request:0x28,0x01,0x01, # Response:0x68,0x01, 应用报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x01,0x01],3)
            if  uds_rep[0:2] != [0x68,0x01]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x01], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x01]
            time.sleep(1)
        with allure.step('step4:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps or -1 == fps

        with allure.step('step5:停发3E 5s后,正常收发'):
            time.sleep(7)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step6:Request:0x10,0x03'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]

        with allure.step('step7:Request:0x28,0x01,0x01,# Response:0x68,0x01, 应用报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x01,0x01],3)
            if  uds_rep[0:2] != [0x68,0x01]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x01], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x01]

            time.sleep(2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

        with allure.step('step8:Request:0x10,0x01,# Response:0x50,0x01, 应用报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x01],2)
            if  uds_rep[0:2] != [0x50,0x01]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x01], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x01]
            time.sleep(2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

    @pytest.mark.smoke
    @allure.severity('normal')
    @allure.description('Test Function failure of 0x28')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    def test_CommunicationControl_Function_failure_after_reset_Extended_Phy(self,action,Driver):
        #test after reset，报文恢复正常发送
         with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
             uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x03],2)
             if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
             with assume: assert uds_rep[0:2] == [0x50,0x03]
         with allure.step('step2:Request:0x28,0x03,0x01# Response:0x68,0x03, 常规应用报文停发'):
             uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x03,0x01],3)
             if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
             with assume: assert uds_rep[0:2] == [0x68,0x03]
             time.sleep(2)

             fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
             if  5 <= fps:
                logging.error(f'correct response:5 > fps, actual response:[{fps}]')
             with assume: assert 6 > fps
         with allure.step('step3:Request:0x11,0x01,# Response:0x51,0x01'):
             uds_rep,size = Driver['UDS'].req_and_res_can([0x11,0x01],2)
             if  uds_rep[0:2] != [0x51,0x01]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x51,0x01], actual response:[{actuRespStr}]')
             with assume: assert uds_rep[0:2] == [0x51,0x01]
             time.sleep(4)


             fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
             if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
             with assume: assert 15 < fps

         with allure.step('step4:Request:0x10,0x03'):
             uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x03],2)
             if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
             with assume: assert uds_rep[0:2] == [0x50,0x03]

         with allure.step('step5:Request:0x28,0x03,0x03,# Response:0x68,0x03, 网络管理报文和常规应用报文停发'):
             uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x03,0x03],3)
             if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
             with assume: assert uds_rep[0:2] == [0x68,0x03]
             time.sleep(2)

             fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
             if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
             with assume: assert 0 == fps

             fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
             if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
             with assume: assert 0 == fps

         with allure.step('step6:Request:0x11,0x01, # Response:0x51,0x01,reset 后，应用报文和网络报文能正常收发'):
             uds_rep,size = Driver['UDS'].req_and_res_can([0x11,0x01],2)
             if  uds_rep[0:2] != [0x51,0x01]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x51,0x01], actual response:[{actuRespStr}]')
             with assume: assert uds_rep[0:2] == [0x51,0x01]
             time.sleep(5)

             fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
             if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
             with assume: assert 15 < fps

            #  fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            # if  0 >= fps:
            #     logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            #  with assume: assert 0 < fps

         with allure.step('step7:Request:0x11,0x01 repeat 5 times, # Response:0x51,0x01,多次重启后ECU不死机'):
             for i in range(5):
                 uds_rep,size = Driver['UDS'].req_and_res_can([0x11,0x01],2)
                 if  uds_rep[0:2] != [0x51,0x01]:
                    actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                    logging.error(f'correct response:[0x51,0x01], actual response:[{actuRespStr}]')
                 with assume: assert uds_rep[0:2] == [0x51,0x01]
                 time.sleep(5)

    ids = ['Request {0}'.format(binascii.b2a_hex(bytearray(req),' ')) for req,resp in NRC7F_Phy] 
    @allure.severity('minor')
    @allure.description('Test NRC7F of 0x28 with physical addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    @pytest.mark.parametrize('req,resp',NRC7F_Phy,ids=ids)
    def test_CommunicationControl_NRC7F_Phy(self,action,Driver,req,resp):
         time.sleep(0.1)
         with allure.step('Step1:Request 0x10,0x01, # Response:0x50,0x01'):
          uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x01],2)
          if  uds_rep[0:2] != [0x50,0x01]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x01], actual response:[{actuRespStr}]')
          with assume:assert uds_rep[0:2] == [0x50,0x01]

         with allure.step('Step2:Request:{0},# Response:{1}'.format(binascii.b2a_hex(bytearray(req),' '),binascii.b2a_hex(bytearray(resp),' '))):
            uds_rep,size = Driver['UDS'].req_and_res_can(req,len(req))
            if size > 0:
                if  uds_rep != resp:
                    actuRespStr = binascii.b2a_hex(bytearray(uds_rep), ' ') 
                    cor_RespStr = binascii.b2a_hex(bytearray(resp), ' ') 
                    logging.error(f'correct response:{cor_RespStr}, actual response:[{actuRespStr}]')
                for i in range(len(resp)):
                    with assume: assert uds_rep[i] == resp[i]
            else:
               with assume: assert 1 == size
               logging.error("no response,size = 0")
		  
    ids = ['Request {0}'.format(binascii.b2a_hex(bytearray(req),' ')) for req,resp in communicationControl_NRC_Phy]   
    @allure.severity('minor')         
    @allure.description('Test negative response code of 0x28 when suppressPosMsgBit is enabled with physical addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    @pytest.mark.parametrize('req,resp',communicationControl_NRC_Phy,ids=ids)
    def test_CommunicationControl_NRC_Phy(self,action,Driver,extend_session,req,resp):
        with allure.step('Step1:Request:{0},# Response:{1}'.format(binascii.b2a_hex(bytearray(req),' '),binascii.b2a_hex(bytearray(resp),' '))):
            uds_rep,size = Driver['UDS'].req_and_res_can(req,len(req))
            if size > 0:
                if  uds_rep != resp:
                    actuRespStr = binascii.b2a_hex(bytearray(uds_rep), ' ') 
                    cor_RespStr = binascii.b2a_hex(bytearray(resp), ' ') 
                    logging.error(f'correct response:{cor_RespStr}, actual response:[{actuRespStr}]')
                for i in range(len(resp)):
                    with assume: assert uds_rep[i] == resp[i]
            else:
                with assume: assert 1 == size
                logging.error("no response,size = 0")

    @allure.severity('normal')
    @allure.description('Test control message by SID 0x28 when suppressPosMsgBit is enabled with physical addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
#    Test postive response of 0x28 in extended session with physical addressing
    def test_CommunicationControl_disableRxAndTx_SuppressPosMsgBit_Extended_Phy(self,action,Driver):
        with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]
        with allure.step('step2:Request:0x3E,0x00,# Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step3:Request:0x28,0x83,0x01, # Response:[], 常规应用报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x83,0x01],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(4)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

        with allure.step('step4:Request:0x28,0x80,0x01,# Response:[], 常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x80,0x01],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            
            time.sleep(1)
        with allure.step('step5:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step6:Request:0x28,0x83,0x03,# Response:[], 网络管理报文和常规应用报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x83,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
        with allure.step('step7:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step8:Request:0x28,0x80,0x03,# Response:[], 网络管理报文和常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x80,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

            time.sleep(1)
        with allure.step('step9:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

        with allure.step('step10:Request:0x28,0x83,0x02,# Response:[], 网络管理报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x83,0x02],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
        with allure.step('step11:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step12:Request:0x28,0x80,0x02,# Response:[], 网络管理报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x80,0x02],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

            time.sleep(1)
        with allure.step('step13:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

    @allure.description('Test Test control message by SID 0x28 when suppressPosMsgBit is enabled with physical addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
#    Test postive response of 0x28 in extended session with physical addressing
    def test_CommunicationControl_enableRxAndDisableTx_SuppressPosMsgBit_Extended_Phy(self,action,Driver):
        with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]
        with allure.step('step2:Request:0x3E,0x00,# Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step3:Request:0x28,0x81,0x01,# Response:[], 常规应用报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x81,0x01],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
        with allure.step('step4:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(4)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

        with allure.step('step5:Request:0x28,0x80,0x01, # Response:[], 常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x80,0x01],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            
            time.sleep(1)
        with allure.step('step6:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step7:Request:0x28,0x83,0x03,# Response:[], 网络管理报文和常规应用报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x83,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
        with allure.step('step8:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step9:Request:0x28,0x80,0x03,# Response:[], 网络管理报文和常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x80,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

            time.sleep(1)
        with allure.step('step10:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

        with allure.step('step11:Request:0x28,0x81,0x02,# Response:[], 网络管理报文停发'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x81,0x02],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
        with allure.step('step12:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step13:Request:0x28,0x80,0x02,# Response:[], 网络管理报文恢复正常发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x80,0x02],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

            time.sleep(1)
        with allure.step('step14:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

    @allure.severity('normal')
    @allure.description('Test Test control message by SID 0x28 when suppressPosMsgBit is enabled with physical addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
#    Test postive response of 0x28 in extended session with physical addressing
    def test_CommunicationControl_disableRxAndEnableTx_SuppressPosMsgBit_Extended_Phy(self,action,Driver):
        with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]
        with allure.step('step2:Request:设置速度信号为1'):
            self.setSignalValue(Driver,SpeedVD_signal,1)
            self.setSignalValue(Driver,SpeedACT_signal,1)
        with allure.step('step3:Request:0x28,0x82,0x01,# Response:[], 禁接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x82,0x01],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step4:Request:设置速度信号为2'):
            self.setSignalValue(Driver,SpeedACT_signal,2)
            time.sleep(4)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step5:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x12'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x0A]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x0A], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x0A]

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step6:Request:0x28,0x80,0x01,# Response:[], 可接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x80,0x01],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            
            time.sleep(1)
        with allure.step('step7:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step8:Request:设置速度信号为2'):
            self.setSignalValue(Driver,SpeedACT_signal,2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)

            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x14]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x14], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x14]
            
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step9:Request:0x28,0x82,0x03,# Response:[], 禁接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x82,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
            self.setSignalValue(Driver,SpeedACT_signal,1)
        with allure.step('step10:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step11:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x14'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x14]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x14], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x14]

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps
        with allure.step('step12:Request:0x28,0x80,0x03,# Response:[], 可接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x80,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

            time.sleep(1)
        with allure.step('step13:Request:设置速度信号为1'):
            self.setSignalValue(Driver,SpeedACT_signal,1)
        with allure.step('step14:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step15:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x0A'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x0A]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x0A], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x0A]
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step16:Request:0x28,0x82,0x02,# Response:[], 禁接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x82,0x02],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
        with allure.step('step17:Request:设置速度信号为2'):
            self.setSignalValue(Driver,SpeedACT_signal,2)
        with allure.step('step18:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step19:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x14'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x14]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x14], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x14]

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps
        with allure.step('step20:Request:0x28,0x80,0x02,# Response:[], 可接收可发送'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x28,0x80,0x02],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

            time.sleep(1)
        with allure.step('step21:Request:设置速度信号为2'):
            self.setSignalValue(Driver,SpeedACT_signal,2)
        with allure.step('step22:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDS'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step23:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x14'):
            uds_rep,size = Driver['UDS'].req_and_res_can([0x22,0x12,0x61],3)
            if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x14]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x14], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x14]

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps
        with allure.step('step24:Request:设置速度信号为0'):
            self.setSignalValue(Driver,SpeedACT_signal,0)
            self.setSignalValue(Driver,SpeedVD_signal,0)

    ids = ['Request {0}'.format(binascii.b2a_hex(bytearray(req),' ')) for req,resp in SuppressPosMsg_NRC11_Phy] 
    @allure.severity('minor')
    @allure.description('Test NRC11 of 0x28 with physical addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    @pytest.mark.parametrize('req,resp',SuppressPosMsg_NRC11_Phy,ids=ids)
    def test_CommunicationControl_NRC11_Phy(self,action,Driver,req,resp):
         time.sleep(0.1)
         with allure.step('step1:Request:0x10,0x01'):
             uds_rep,size = Driver['UDS'].req_and_res_can([0x10,0x01],2)
             if  uds_rep[0:2] != [0x50,0x01]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x01], actual response:[{actuRespStr}]')
             with assume: assert uds_rep[0:2] == [0x50,0x01]
         with allure.step('Step2:Request:{0},# Response:{1}'.format(binascii.b2a_hex(bytearray(req),' '),binascii.b2a_hex(bytearray(resp),' '))):
            uds_rep,size = Driver['UDS'].req_and_res_can(req,len(req))
            if size > 0:
                if  uds_rep != resp:
                         actuRespStr = binascii.b2a_hex(bytearray(uds_rep), ' ') 
                         cor_RespStr = binascii.b2a_hex(bytearray(resp), ' ') 
                         logging.error(f'correct response:{cor_RespStr}, actual response:[{actuRespStr}]')
                for i in range(len(resp)):
                    with assume: assert uds_rep[i] == resp[i]
            else:
               with assume: assert 1 == size
               logging.error("no response,size = 0")

    ids = ['Request {0}'.format(binascii.b2a_hex(bytearray(req),' ')) for req,resp in communicationControl_SuppressPosMsg_NRC_Phy] 
    @allure.severity('normal')         
    @allure.description('Test negative response code of 0x28 when suppressPosMsgBit is enabled with physical addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    @pytest.mark.parametrize('req,resp',communicationControl_SuppressPosMsg_NRC_Phy,ids=ids)
    def test_CommunicationControl_SuppressPosMsgBit_NRC_Phy(self,action,Driver,extend_session,req,resp):
         #Test NRC13 of 0x28 when length of request is invalid
        with allure.step('Step1:Request:{0},# Response:{1}'.format(binascii.b2a_hex(bytearray(req),' '),binascii.b2a_hex(bytearray(resp),' '))):
            uds_rep,size = Driver['UDS'].req_and_res_can(req,len(req))
            if size > 0:
                if  uds_rep != resp:
                         actuRespStr = binascii.b2a_hex(bytearray(uds_rep), ' ') 
                         cor_RespStr = binascii.b2a_hex(bytearray(resp), ' ') 
                         logging.error(f'correct response:{cor_RespStr}, actual response:[{actuRespStr}]')
                for i in range(len(resp)):
                    with assume: assert uds_rep[i] == resp[i]
            else:
               with assume: assert 1 == size
               logging.error("no response,size = 0")

class Test_CommunicationControl_Fun(object):


    def setSignalValue(self, Driver,signal_list,value):
        Driver['CAN'].write_db_signal(signal_list[0],signal_list[1], signal_list[2], signal_list[3], value)
        time.sleep(0.2)
        readValue = Driver['CAN'].read_db_signal(signal_list[0],signal_list[1], signal_list[2], signal_list[3])

    @allure.severity('normal')
    @allure.story('Communication Control Test')
    @allure.description('Test control message by SID 0x28 with functional addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    def test_CommunicationControl_disableRxAndTx_Extended_Fun(self,action,Driver):
        iStep = 1
        iStep, uds_resp, size = Driver['CAN'].checkReqResp(Driver, '3E00', '7E00', 3, iStep, False)
        # 常规应用报文停发
        iStep, uds_resp, size = Driver['CAN'].checkReqResp(Driver, '280301', '6803', 0, iStep, False)
        time.sleep(1)
        iStep, uds_resp, size = Driver['CAN'].checkReqResp(Driver, '3E00', '7E00', 0, iStep, False)
        time.sleep(4)
        iStep, uds_resp, size = Driver['CAN'].checkReqResp(Driver, '3E00', '7E00', 0, iStep, False)

        fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
        if  0 != fps:
            logging.error(f'correct response:0 == fps, actual response:[{fps}]')
        with assume: assert 0 == fps

        with allure.step('step4:Request:0x28,0x00,0x01,# Response:0x68,0x00, 常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x01],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]
            
            time.sleep(1)
        with allure.step('step5:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step6:Request:0x28,0x03,0x03,# Response:0x68,0x03, 网络管理报文和常规应用报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x03,0x03],3)
            if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x03]
            time.sleep(1)
        with allure.step('step7:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step8:Request:0x28,0x00,0x03,# Response:0x68,0x00, 网络管理报文和常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x03],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]

            time.sleep(1)
        with allure.step('step9:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

        with allure.step('step10:Request:0x28,0x03,0x02,# Response:0x68,0x03, 网络管理报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x03,0x02],3)
            if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x03]
            time.sleep(1)
        with allure.step('step11:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step12:Request:0x28,0x00,0x02,# Response:0x68,0x00, 网络管理报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x02],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]

            time.sleep(1)
        with allure.step('step13:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

    @allure.severity('normal')
    @allure.description('Test Test control message by SID 0x28 with functional addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
#    Test postive response of 0x28 in extended session with physical addressing
    def test_CommunicationControl_enableRxAndDisableTx_Extended_Fun(self,action,Driver):
        with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]
        with allure.step('step2:Request:0x3E,0x00,# Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step3:Request:0x28,0x03,0x01,# Response:0x68,0x03, 常规应用报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x03,0x01],3)
            if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x03]
            time.sleep(1)
        with allure.step('step4:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(4)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

        with allure.step('step5:Request:0x28,0x00,0x01,# Response:0x68,0x00, 常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x01],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]
            
            time.sleep(1)
        with allure.step('step6:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step7:Request:0x28,0x03,0x03,# Response:0x68,0x03, 网络管理报文和常规应用报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x03,0x03],3)
            if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x03]
            time.sleep(1)
        with allure.step('step8:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step9:Request:0x28,0x00,0x03,# Response:0x68,0x00, 网络管理报文和常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x03],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]

            time.sleep(1)
        with allure.step('step10:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

        with allure.step('step11:Request:0x28,0x03,0x02,# Response:0x68,0x03, 网络管理报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x03,0x02],3)
            if  uds_rep[0:2] != [0x68,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x03], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x03]
            time.sleep(1)
        with allure.step('step12:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step13:Request:0x28,0x00,0x02,# Response:0x68,0x00, 网络管理报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x02],3)
            if  uds_rep[0:2] != [0x68,0x00]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x68,0x00]

            time.sleep(1)
        with allure.step('step14:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

#     @allure.severity('normal')
#     @allure.description('Test Test control message by SID 0x28 with functional addressing')
#     @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
# #    Test postive response of 0x28 in extended session with physical addressing
#     def test_CommunicationControl_disableRxAndEnableTx_Extended_Fun(self,action,Driver):
#         with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x10,0x03],2)
#             if  uds_rep[0:2] != [0x50,0x03]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:2] == [0x50,0x03]
#         with allure.step('step2:Request:设置速度信号为1'):
#             self.setSignalValue(Driver,SpeedVD_signal,1)
#             self.setSignalValue(Driver,SpeedACT_signal,1)
#         with allure.step('step3:Request:0x28,0x02,0x01,# Response:0x68,0x02, 禁接收可发送'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x02,0x01],3)
#             if  uds_rep[0:2] != [0x68,0x02]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x68,0x02], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:2] == [0x68,0x02]
#             time.sleep(1)
#         with allure.step('step4:Request:0x3E,0x00, # Response:0x7E,0x00'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#         with allure.step('step5:Request:设置速度信号为2'):
#             self.setSignalValue(Driver,SpeedACT_signal,2)
#             time.sleep(4)
#         with allure.step('step6:Request:0x3E,0x00, # Response:0x7E,0x00'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#         with allure.step('step7:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x12'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
#             if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x12]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x12], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x12]

#             fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
#             if  15 >= fps:
#                 logging.error(f'correct response:15 < fps, actual response:[{fps}]')
#             with assume: assert 15 < fps

#         with allure.step('step8:Request:0x28,0x00,0x01,# Response:0x68,0x00, 可接收可发送'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x01],3)
#             if  uds_rep[0:2] != [0x68,0x00]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:2] == [0x68,0x00]
            
#             time.sleep(1)
#         with allure.step('step9:Request:0x3E,0x00, # Response:0x7E,0x00'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#         with allure.step('step10:Request:设置速度信号为2'):
#             self.setSignalValue(Driver,SpeedACT_signal,2)
#             time.sleep(1)
#         with allure.step('step11:Request:0x3E,0x00, # Response:0x7E,0x00'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#         with allure.step('step12:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x24'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
#             if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x24]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x24], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x24]
            
#             fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
#             if  15 >= fps:
#                 logging.error(f'correct response:15 < fps, actual response:[{fps}]')
#             with assume: assert 15 < fps

#         with allure.step('step13:Request:0x28,0x02,0x03,# Response:0x68,0x02, 禁接收可发送'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x02,0x03],3)
#             if  uds_rep[0:2] != [0x68,0x02]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x68,0x02], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:2] == [0x68,0x02]
#             time.sleep(1)
#         with allure.step('step14:Request:设置速度信号为1'):
#             self.setSignalValue(Driver,SpeedACT_signal,1)
#         with allure.step('step15:Request:0x3E,0x00, # Response:0x7E,0x00'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#             time.sleep(1)
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#         with allure.step('step16:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x24'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
#             if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x24]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x24], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x24]

#             fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
#             if  15 >= fps:
#                 logging.error(f'correct response:15 < fps, actual response:[{fps}]')
#             with assume: assert 15 < fps
#         with allure.step('step17:Request:0x28,0x00,0x03,# Response:0x68,0x00, 可接收可发送'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x03],3)
#             if  uds_rep[0:2] != [0x68,0x00]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:2] == [0x68,0x00]

#             time.sleep(1)
#         with allure.step('step18:Request:设置速度信号为1'):
#             self.setSignalValue(Driver,SpeedACT_signal,1)
#         with allure.step('step19:Request:0x3E,0x00, # Response:0x7E,0x00'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#             time.sleep(1)
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#         with allure.step('step20:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x12'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
#             if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x12]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x12], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x12]
#             fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
#             if  15 >= fps:
#                 logging.error(f'correct response:15 < fps, actual response:[{fps}]')
#             with assume: assert 15 < fps

#         with allure.step('step21:Request:0x28,0x02,0x02,# Response:0x68,0x02, 禁接收可发送'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x02,0x02],3)
#             if  uds_rep[0:2] != [0x68,0x02]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x68,0x02], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:2] == [0x68,0x02]
#             time.sleep(1)
#         with allure.step('step22:Request:设置速度信号为2'):
#             self.setSignalValue(Driver,SpeedACT_signal,2)
#         with allure.step('step23:Request:0x3E,0x00, # Response:0x7E,0x00'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#             time.sleep(1)
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#         with allure.step('step24:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x12'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
#             if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x12]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x12], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x12]

#             fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
#             if  15 >= fps:
#                 logging.error(f'correct response:15 < fps, actual response:[{fps}]')
#             with assume: assert 15 < fps
#         with allure.step('step25:Request:0x28,0x00,0x02,# Response:0x68,0x00, 可接收可发送'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x02],3)
#             if  uds_rep[0:2] != [0x68,0x00]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x68,0x00], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:2] == [0x68,0x00]

#             time.sleep(1)
#         with allure.step('step26:Request:设置速度信号为2'):
#             self.setSignalValue(Driver,SpeedACT_signal,2)
#         with allure.step('step27:Request:0x3E,0x00, # Response:0x7E,0x00'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#             time.sleep(1)
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
#         with allure.step('step28:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x24'):
#             uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
#             if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x24]:
#                 actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
#                 logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x24], actual response:[{actuRespStr}]')
#             with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x24]

#             fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
#             if  15 >= fps:
#                 logging.error(f'correct response:15 < fps, actual response:[{fps}]')
#             with assume: assert 15 < fps
#         with allure.step('step29:Request:设置速度信号为0'):
#             self.setSignalValue(Driver,SpeedACT_signal,0)
#             self.setSignalValue(Driver,SpeedVD_signal,0)


    ids = ['Request {0}'.format(binascii.b2a_hex(bytearray(req),' ')) for req,resp in communicationControl_NRC13_Fun]    
    @allure.severity('minor')
    @allure.description('Test NRC13 of 0x28 when suppressPosMsgBit is enabled with functional addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    @pytest.mark.parametrize('req,resp',communicationControl_NRC13_Fun,ids=ids)
    def test_CommunicationControl_NRC13_Fun(self,action,Driver,extend_session,req,resp):
        with allure.step('Step1:Request:{0},# Response:{1}'.format(binascii.b2a_hex(bytearray(req),' '),binascii.b2a_hex(bytearray(resp),' '))):
            uds_rep,size = Driver['UDSFun'].req_and_res_can(req,len(req))
            if size > 0:
                if  uds_rep != resp:
                    actuRespStr = binascii.b2a_hex(bytearray(uds_rep), ' ') 
                    cor_RespStr = binascii.b2a_hex(bytearray(resp), ' ') 
                    logging.error(f'correct response:{cor_RespStr}, actual response:[{actuRespStr}]')
                for i in range(len(resp)):
                    with assume: assert uds_rep[i] == resp[i]
            else:
                with assume: assert 1 == size
                logging.error("no response,size = 0")
            time.sleep(1)

    ids = ['Request {0}'.format(binascii.b2a_hex(bytearray(req),' ')) for req,resp in communicationControl_No_Resp_Fun]    
    @allure.severity('minor')
    @allure.description('Test no response of 0x28 when suppressPosMsgBit is enabled with functional addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    @pytest.mark.parametrize('req,resp',communicationControl_No_Resp_Fun,ids=ids)
    def test_CommunicationControl_No_Resp_Fun(self,action,Driver,extend_session,req,resp):
        with allure.step('Step1:Request:{0},# Response:{1}'.format(binascii.b2a_hex(bytearray(req),' '),binascii.b2a_hex(bytearray(resp),' '))): 
            uds_rep,size = Driver['UDSFun'].req_and_res_can(req,len(req))
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            assert size == 0

    @allure.severity('minor')
    @allure.description('Test negative response code of 0x28 in default session with function addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
#    Test NRC of 0x28 with function addressing
    def test_CommunicationControl_NRC_defaulted_Fun(self,action,Driver,default_session):
         # Request 0x28 when ecu is in default session
        with allure.step('step1:Request:0x10,0x01, # Response: 0x50,0x01'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x10,0x01],2)
            if  uds_rep[0:2] != [0x50,0x01]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x01], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x01]
        with allure.step('step2:Request:0x28,0x00,0x03, # Response:[]'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
        with allure.step('step3:Request:0x28,0x80,0x03, # Response:[]'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x80,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

    @allure.severity('normal')
    @allure.description('Test control message by SID 0x28 when suppressPosMsgBit is enabled with functional addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    def test_CommunicationControl_disableRxAndTx_SuppressPosMsgBit_Extended_Fun(self,action,Driver):
        with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]
        with allure.step('step2:Request:0x3E,0x00,# Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step3:Request:0x28,0x83,0x01,# Response:[], 常规应用报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x83,0x01],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(4)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

        with allure.step('step4:Request:0x28,0x00,0x01,# Response:[], 常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x80,0x01],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            
            time.sleep(1)
        with allure.step('step5:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step6:Request:0x28,0x83,0x03,# Response:[], 网络管理报文和常规应用报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x83,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
        with allure.step('step7:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step8:Request:0x28,0x80,0x03,# Response:[], 网络管理报文和常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x80,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

            time.sleep(1)
        with allure.step('step9:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

        with allure.step('step10:Request:0x28,0x83,0x02,# Response:[], 网络管理报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x83,0x02],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
        with allure.step('step11:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step12:Request:0x28,0x80,0x02,# Response:[], 网络管理报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x80,0x02],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

            time.sleep(1)
        with allure.step('step13:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

    @allure.severity('normal')
    @allure.description('Test Test control message by SID 0x28 when suppressPosMsgBit is enabled with functional addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    def test_CommunicationControl_enableRxAndDisableTx_SuppressPosMsgBit_Extended_Fun(self,action,Driver):
        with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x10,0x03],2)
            if  uds_rep[0:2] != [0x50,0x03]:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
                logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
            with assume: assert uds_rep[0:2] == [0x50,0x03]
        with allure.step('step2:Request:0x3E,0x00,# Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step3:Request:0x28,0x81,0x01,# Response:[], 常规应用报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x81,0x01],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
        with allure.step('step4:Request:0x3E,0x00,# Response:0x7E,0x00'):
            time.sleep(4)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

        with allure.step('step5:Request:0x28,0x80,0x01,# Response:[], 常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x80,0x01],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            
            time.sleep(1)
        with allure.step('step6:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

        with allure.step('step7:Request:0x28,0x83,0x03,# Response:[], 网络管理报文和常规应用报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x83,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
        with allure.step('step8:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step9:Request:0x28,0x80,0x03,# Response:[], 网络管理报文和常规应用报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x80,0x03],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  15 >= fps:
                logging.error(f'correct response:15 < fps, actual response:[{fps}]')
            with assume: assert 15 < fps

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

        with allure.step('step10:Request:0x28,0x81,0x02,# Response:[], 网络管理报文停发'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x81,0x02],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0
            time.sleep(1)
        with allure.step('step11:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps
        with allure.step('step12:Request:0x28,0x80,0x02,# Response:[], 网络管理报文恢复正常发送'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x80,0x02],3)
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume: assert size == 0

            time.sleep(1)
        with allure.step('step13:Request:0x3E,0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(1)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
            if  0 >= fps:
                logging.error(f'correct response:0 < fps, actual response:[{fps}]')
            with assume: assert 0 < fps

    # @allure.severity('normal')
    # @allure.description('Test Test control message by SID 0x28 when suppressPosMsgBit is enabled with functional addressing')
    # @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    # def test_CommunicationControl_disableRxAndEnableTx_SuppressPosMsgBit_Extended_Fun(self,action,Driver):
    #     with allure.step('step1:Request:0x10,0x03,# Response:0x50,0x03'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x10,0x03],2)
    #         if  uds_rep[0:2] != [0x50,0x03]:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
    #             logging.error(f'correct response:[0x50,0x03,0x00,0x32,0x00,0xC8], actual response:[{actuRespStr}]')
    #         with assume: assert uds_rep[0:2] == [0x50,0x03]
    #     with allure.step('step2:Request:设置速度信号为1'):
    #         self.setSignalValue(Driver,SpeedVD_signal,1)
    #         self.setSignalValue(Driver,SpeedACT_signal,1)
    #     with allure.step('step3:Request:0x28,0x82,0x01,# Response:[], 禁接收可发送'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x82,0x01],3)
    #         if  size != 0:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
    #             logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
    #         with assume: assert size == 0
    #         time.sleep(1)
    #     with allure.step('step4:Request:0x3E,0x00,# Response:0x7E,0x00'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #     with allure.step('step5:Request:设置速度信号为2'):
    #         self.setSignalValue(Driver,SpeedACT_signal,2)
    #         time.sleep(4)
    #     with allure.step('step6:Request:0x3E,0x00,# Response:0x7E,0x00'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #     with allure.step('step7:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x12'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
    #         if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x12]:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
    #             logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x12], actual response:[{actuRespStr}]')
    #         with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x12]

    #         fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
    #         if  15 >= fps:
    #             logging.error(f'correct response:15 < fps, actual response:[{fps}]')
    #         with assume: assert 15 < fps

    #     with allure.step('step8:Request:0x28,0x80,0x01,# Response:[], 可接收可发送'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x80,0x01],3)
    #         if  size != 0:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
    #             logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
    #         with assume: assert size == 0
            
    #         time.sleep(1)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #     with allure.step('step9:Request:设置速度信号为2'):
    #         self.setSignalValue(Driver,SpeedACT_signal,2)
    #         time.sleep(1)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #     with allure.step('step10:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x24'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
    #         if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x24]:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
    #             logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x24], actual response:[{actuRespStr}]')
    #         with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x24]
            
    #         fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
    #         if  15 >= fps:
    #             logging.error(f'correct response:15 < fps, actual response:[{fps}]')
    #         with assume: assert 15 < fps

    #     with allure.step('step11:Request:0x28,0x82,0x03,# Response:[], 禁接收可发送'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x82,0x03],3)
    #         if  size != 0:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
    #             logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
    #         with assume: assert size == 0
    #         time.sleep(1)
    #     with allure.step('step12:Request:设置速度信号为1'):
    #         self.setSignalValue(Driver,SpeedACT_signal,1)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #         time.sleep(1)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #     with allure.step('step13:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x24'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
    #         if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x24]:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
    #             logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x24], actual response:[{actuRespStr}]')
    #         with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x24]

    #         fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
    #         if  15 >= fps:
    #             logging.error(f'correct response:15 < fps, actual response:[{fps}]')
    #         with assume: assert 15 < fps
    #     with allure.step('step14:Request:0x28,0x80,0x03,# Response:[], 可接收可发送'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x80,0x03],3)
    #         if  size != 0:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
    #             logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
    #         with assume: assert size == 0

    #         time.sleep(1)
    #         self.setSignalValue(Driver,SpeedACT_signal,1)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #         time.sleep(1)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #     with allure.step('step15:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x12'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
    #         if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x12]:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
    #             logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x12], actual response:[{actuRespStr}]')
    #         with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x12]
    #         fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
    #         if  15 >= fps:
    #             logging.error(f'correct response:15 < fps, actual response:[{fps}]')
    #         with assume: assert 15 < fps

    #     with allure.step('step16:Request:0x28,0x82,0x02,# Response:[], 禁接收可发送'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x82,0x02],3)
    #         if  size != 0:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
    #             logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
    #         with assume: assert size == 0
    #         time.sleep(1)
    #     with allure.step('step17:Request:设置速度信号为2'):
    #         self.setSignalValue(Driver,SpeedACT_signal,2)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #         time.sleep(1)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #     with allure.step('step18:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x12'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
    #         if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x12]:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
    #             logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x12], actual response:[{actuRespStr}]')
    #         with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x12]

    #         fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
    #         if  15 >= fps:
    #             logging.error(f'correct response:15 < fps, actual response:[{fps}]')
    #         with assume: assert 15 < fps
    #     with allure.step('step19:Request:0x28,0x80,0x02,# Response:[], 可接收可发送'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x80,0x02],3)
    #         if  size != 0:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
    #             logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
    #         with assume: assert size == 0
    #     with allure.step('step20:Request:设置速度信号为2'):
    #         time.sleep(1)
    #         self.setSignalValue(Driver,SpeedACT_signal,2)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #         time.sleep(1)
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
    #     with allure.step('step21:Request:0x22,0x12,0x61,# Response:0x62,0x12,0x61,0x00,0x24'):
    #         uds_rep,size = Driver['UDSFun'].req_and_res_can([0x22,0x12,0x61],3)
    #         if  uds_rep[0:5] != [0x62,0x12,0x61,0x00,0x24]:
    #             actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ') 
    #             logging.error(f'correct response:[0x62,0x12,0x61,0x00,0x24], actual response:[{actuRespStr}]')
    #         with assume: assert uds_rep[0:5] == [0x62,0x12,0x61,0x00,0x24]

    #         fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
    #         if  15 >= fps:
    #             logging.error(f'correct response:15 < fps, actual response:[{fps}]')
    #         with assume: assert 15 < fps
    #     with allure.step('step22:Request:设置速度信号为0'):
    #         self.setSignalValue(Driver,SpeedACT_signal,0)
    #         self.setSignalValue(Driver,SpeedVD_signal,0)

    ids = ["Request {0}".format(binascii.b2a_hex(bytearray(req),' ')) for req,resp in communicationControl_SuppressPosMsg_NRC13_Fun]   
    @allure.severity('minor')
    @allure.description('Test NRC13 of 0x28 when suppressPosMsgBit is enabled with functional addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    @pytest.mark.parametrize('req,resp',communicationControl_SuppressPosMsg_NRC13_Fun,ids = ids)
    def test_CommunicationControl_SuppressPosMsg_NRC13_Func(self,action,Driver,extend_session,req,resp):
        with allure.step('step1:Request:{0}, # Response:{1}'.format(binascii.b2a_hex(bytearray(req),' '),binascii.b2a_hex(bytearray(resp),' '))):
            uds_rep,size = Driver['UDSFun'].req_and_res_can(req,len(req))
            if size > 0:
                if  uds_rep != resp:
                    actuRespStr = binascii.b2a_hex(bytearray(uds_rep), ' ') 
                    cor_RespStr = binascii.b2a_hex(bytearray(resp), ' ') 
                    logging.error(f'correct response:{cor_RespStr}, actual response:[{actuRespStr}]')
                for i in range(len(resp)):
                    with assume: assert uds_rep[i] == resp[i]
            else:
                with assume: assert 1 == size
                logging.error("no response,size = 0")

    ids = ['Request {0}'.format(binascii.b2a_hex(bytearray(req),' ')) for req,resp in communicationControl_SuppressPosMsg_No_Resp_Fun]   
    @allure.severity('minor')
    @allure.description('Test no response of 0x28 when suppressPosMsgBit is enabled with functional addressing')
    @allure.testcase('https://chengtech.pingcode.com/testhub/libraries/6306e0482ce6d84a055b6e90/cases')
    @pytest.mark.parametrize('req,resp',communicationControl_SuppressPosMsg_No_Resp_Fun,ids = ids)
    def test_CommunicationControl_SuppressPosMsg_No_Resp_Func(self,action,Driver,extend_session,req,resp):
        with allure.step('step1:Request:{0}, # Response:{1}'.format(binascii.b2a_hex(bytearray(req),' '),binascii.b2a_hex(bytearray(resp),' '))):
            uds_rep,size = Driver['UDSFun'].req_and_res_can(req,len(req))
            if  size != 0:
                actuRespStr = binascii.b2a_hex(bytearray(uds_rep[:]), ' ')  
                logging.error(f'correct response:[none], actual response:[{actuRespStr}]')
            with assume:assert size == 0





    def test_lllll(action,Driver):
        '''
        Sub-F:0x00 使能接收和发送
        Sub-F:0x01 使能接收且禁止发送
        Sub-F:0x02 禁止接收且使能发送
        Sub-F:0x03 禁止接收和发送
        prameter:0x01 常规应用报文
        prameter:0x02 网络管理报文
        prameter:0x03 网络管理报文和常规应用报文
        '''
        with allure.step('step3:Request:0x28,0x83,0x01,# Response:[], 常规应用报文停发'):
            comm = Modbus('COM8')
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x10,0x03],2)
            time.sleep(1)
            # uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x03,0x01],3)
            # uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x01,0x01],3)
            # uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x03,0x03],3)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x01,0x03],3)
            time.sleep(2)
            fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
            if  0 != fps:
                logging.error(f'correct response:0 == fps, actual response:[{fps}]')
            with assume: assert 0 == fps

        with allure.step('Step2:Request:0x3E 0x00, # Response:0x7E,0x00'):
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(4)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)

            time.sleep(4)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(4)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(4)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            time.sleep(4)
            uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            with allure.step("Step3:CANH connects to CANL"):
                comm.write_single_coil(DO_Address_single.Y2.value,0x0001)
                logging.info('CANH connects to CANL duration of 0.1s')
                uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
                time.sleep(2)
            with allure.step("Step4:Remove fault of CANH connnects to CANL"):
                comm.write_single_coil(DO_Address_single.Y2.value,0x0000)
                logging.info('CANH disconnect to CANL duration of 0.1s')
                uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
                time.sleep(1)
                uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
            with allure.step("Step3:CANH connects to CANL"):
                comm.write_single_coil(DO_Address_single.Y2.value,0x0001)
                logging.info('CANH connects to CANL duration of 0.1s')
                # uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
                time.sleep(2)
            with allure.step("Step4:Remove fault of CANH connnects to CANL"):
                comm.write_single_coil(DO_Address_single.Y2.value,0x0000)
                logging.info('CANH disconnect to CANL duration of 0.1s')
                # uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
                time.sleep(2)

                uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x00,0x03],3)
                time.sleep(2)

                fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
                if  15 >= fps:
                    logging.error(f'correct response:15 < fps, actual response:[{fps}]')
                with assume: assert 15 < fps

                fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
                if  0 >= fps:
                    logging.error(f'correct response:0 < fps, actual response:[{fps}]')
                with assume: assert 0 < fps


    @pytest.mark.repeat(1)
    def test_frame_for_radar22222(action,Driver):
        '''
        发车身报文，NM报文,电源信号一致off，等3分钟，VcanH短接VcanL，电源为2前恢复，或者后面恢复，check 雷达应用报文
        需手动短接，PLC短接未复现
        '''
        iStep = 1
        # 设置电压为0V
        Driver['power'].set_vltage(0)
        # 停发唤醒
        Driver['CAN'].wakeup_ctrl(False)
        logging.info('delay 5s')
        time.sleep(5)
        Driver['power'].Read_Measure()
        uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x01,0x03],3)

        # 设置电压为12v 
        Driver['power'].set_vltage(12)
        logging.info('delay 5s')
        time.sleep(5)
        Driver['power'].Read_Measure()
        # 使能check lossframe
        # # need todo
        # Driver['CAN3'].register_event_canfd_T_R(PCAN_Check_F_ref)
        # Enable_check_PCAN_CheckRoll_fun(True)

        # 正常唤醒
        # Driver['CAN'].wakeup_ctrl(True)
        # Driver['CAN'].send_CANFrame_Cycle(0x411,[0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF],500)
        Driver['CAN'].send_CANFrame_Cycle(0x44C,[0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00],500)
        uds_rep,size = Driver['UDSFun'].req_and_res_can([0x28,0x01,0x03],3)
        Driver['CAN'].set_signal_IGN(2)
        Driver['CAN'].set_signal_EMS5_St_EngineRunning(2)
        Driver['CAN'].set_signal_Gear(4)
        time.sleep(120)   # 过程中手动短接
        Driver['CAN'].set_signal_IGN(2)

        time.sleep(20)   # 过程中手动短接
        # Driver['CAN'].set_signal_IGN(2)
        # time.sleep(50)   # 过程中手动短接
        # Driver['CAN'].set_signal_IGN(1)

        # Driver['CAN'].set_signal_IGN(2)
        # time.sleep(20)



        # comm = Modbus('COM3')
        # fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
        # if  0 == fps:
        #     logging.error(f'correct response:0 < fps, actual response:[{fps}]')
        # with assume: assert 0 < fps

        
        # with allure.step("Step3:CANH connects to CANL"):
        #     comm.write_single_coil(DO_Address_single.Y7.value,0x0001)
        #     logging.info('CANH connects to CANL duration of 0.1s')
        #     uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
        #     time.sleep(4)
        # with allure.step("Step4:Remove fault of CANH connnects to CANL"):
        #     comm.write_single_coil(DO_Address_single.Y7.value,0x0000)
        #     logging.info('CANH disconnect to CANL duration of 0.1s')
        #     time.sleep(1)
        #     uds_rep,size = Driver['UDSFun'].req_and_res_can([0x3E,0x00],2)
        # with allure.step("Step3:CANH connects to CANL"):
        #     comm.write_single_coil(DO_Address_single.Y7.value,0x0001)
        #     logging.info('CANH connects to CANL duration of 0.1s')
        #     time.sleep(4)
        # with allure.step("Step4:Remove fault of CANH connnects to CANL"):
        #     comm.write_single_coil(DO_Address_single.Y7.value,0x0000)
        #     logging.info('CANH disconnect to CANL duration of 0.1s')

        time.sleep(2)
        Driver['CAN'].set_signal_IGN(2)

        fps = Driver['CAN'].get_fps(Message_ID.Radar_App_message_ID,CAN_Type='CANFD')
        if  15 >= fps:
            logging.error(f'correct response:15 < fps, actual response:[{fps}]')
        with assume: assert 15 < fps
        time.sleep(2)

        fps = Driver['CAN'].get_fps(Message_ID.Radar_NM_message_ID,CAN_Type='CANFD')
        if  0 >= fps:
            logging.error(f'correct response:0 < fps, actual response:[{fps}]')
        with assume: assert 0 < fps

        Driver['CAN'].set_signal_EMS5_St_EngineRunning(0)